﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MauiApp5.Models;
using MauiApp5.Views;
using Microsoft.Maui.ApplicationModel.Communication;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace MauiApp5.ViewModels
{
    partial class Newpage1ViewMode: ObservableObject
    {
        
        public ObservableCollection<UserIonf> UserInfo { get; set; }
        [ObservableProperty]
        private UserIonf? selectedItem;
        
        public Newpage1ViewMode()
        {
            UserInfo = new ObservableCollection<UserIonf>();
            UserInfo.Add(new UserIonf
            {
                Id = 1,
                Name = "高圆圆",
                Loacation = "北京",
                Age = 44,
                Gender = "女",
                IsAuthentication = true,
                ImageUrl = "https://img1.doubanio.com/view/personage/m/public/2de309f951c12df28dc9d1dfb424e719.jpg"
            });
            UserInfo.Add(new UserIonf
            {
                Id = 2,
                Name = "特斯拉",
                Loacation = "奥地利",
                
                Gender = "男",
                IsAuthentication = true,
                ImageUrl = "https://img3.doubanio.com/view/celebrity/m/public/p1364220596.07.webp"
            });
            UserInfo.Add(new UserIonf
            {
                Id = 3,
                Name = "杨幂",
                Loacation = "北京",
                Age = 43,
                Gender = "女",
                IsAuthentication = true,
                ImageUrl = "https://img1.doubanio.com/view/photo/photo/public/p2530712868.webp"
            });
            UserInfo.Add(new UserIonf
            {
                Id = 4,
                Name = "高圆圆",
                Loacation = "北京",
                Age = 44,
                Gender = "女",
                IsAuthentication = true,
                ImageUrl = "https://img1.doubanio.com/view/personage/m/public/2de309f951c12df28dc9d1dfb424e719.jpg"
            });
            UserInfo.Add(new UserIonf
            {
                Id = 5,
                Name = "古天乐",
                Loacation = "香港",
                Age = 44,
                Gender = "男",
                IsAuthentication = true,
                ImageUrl = "https://img1.doubanio.com/view/personage/m/public/3f6b53762bdc6201d539922aa7391e00.jpg"
            });

            
        }
        [RelayCommand]
         async void UserSelectItem(object obj)
        {
            if (SelectedItem == null)
                return;
            await Shell.Current.GoToAsync("UserXPage");
            SelectedItem = null;
        }



    }
}
